package com.g.base.extend

import android.content.Context
import android.graphics.Point
import android.os.Handler
import android.support.v4.app.Fragment
import android.view.WindowManager
import android.widget.Toast
import com.g.base.appContent

/**
 * Created by G on 2017/8/9 0009.
 */
//TOAST
fun Context.toast(message: String) {
    Handler(appContent.mainLooper).post {
        Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
    }
}

fun Fragment.toast(message: String) {
    activity?.toast(message)
}

fun Context.getScreenPoint(): Point {
    val wm = appContent.getSystemService(Context.WINDOW_SERVICE) as WindowManager
    val point = Point()
    wm.defaultDisplay.getRealSize(point)
    return point
}
